//
//  YYEBalanceSwitchTableViewCell.m
//  YuYingEDU
//
//  Created by 胡波 on 2018/1/22.
//  Copyright © 2018年 胡波. All rights reserved.
//

#import "YYEBalanceSwitchTableViewCell.h"

@implementation YYEBalanceSwitchTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.balanceLabel = [[UILabel alloc]init];
        self.balanceLabel.text = @"账户余额:";
        self.balanceLabel.textColor = [UIColor blackColor];
        self.balanceLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.balanceLabel];
        
        self.priceLabel = [[UILabel alloc]init];
        self.priceLabel.textColor = [UIColor redColor];
        self.priceLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.priceLabel];
        
//        self.moneySwitch = [[UISwitch alloc]init];
//        [self.contentView addSubview:self.moneySwitch];
        self.moneyBtn = [UIButton buttonWithframe:CGRectZero text:nil font:nil textColor:nil backgroundColor:nil normal:@"offImage" selected:@"onImage"];
        [self.contentView addSubview:self.moneyBtn];
        
    }
    return self;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.balanceLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(24);
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    [self.priceLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.balanceLabel.right);
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    [self.moneyBtn makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.right).offset(-10);
        make.centerY.equalTo(self.contentView.centerY);
        make.size.equalTo(CGSizeMake(52, 24));
    }];
    
//    [self.moneySwitch makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self.contentView.right).offset(-10);
//        make.centerY.equalTo(self.contentView.centerY);
////        make.size.equalTo(CGSizeMake(52, 24));
//    }];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
